export function renderKeyValues(h, row, columns = [], index, option = {}) {
  let self = this
  function truncateString(str, num) {
    if (str.length > num) {
      return str.slice(0, num) + "...";
    } else {
      return str;
    }
  }

  return columns
    .filter(column => !column.actions)
    .map(column => {

      let label = column.label;
      let value = row[column.prop];

      if (column.formatter) {
        value =  column.formatter(row, column, value, index, option)
      }
      let _content;

      // console.log(typeof value)
      // if (typeof value === 'string') {
      //   _content = ( <el-tooltip effect="dark" content={row[column.prop]}>
      //     <div>{truncateString(value, 10)}</div>
      //   </el-tooltip>)
      // } else {
      //   _content = value
      // }

      _content = value

      return (<zw-layout class="detail-kv__row" row>
        <zw-layout class="detail-kv__label">{label}</zw-layout>
        <zw-layout class="detail-kv__value" expand>{_content}</zw-layout>
      </zw-layout>)
    })
}
